import java.util.Scanner;
 		
 		public class Anagram {
 		    public static void main(String args[]) {
 		         System.out.println("Please write first phrase");
 		                Scanner in = new Scanner(System.in);
 		        char [] first_input_phrase = in.nextLine().toLowerCase().replaceAll("[ \t]", "").toCharArray();
 		                System.out.println("Please write second phrase");
 		        char [] second_input_phrase = in.nextLine().toLowerCase().replaceAll("[ \t]", "").toCharArray();
 		       
 		            if (Anagram_indeed(first_input_phrase, second_input_phrase)) {
 		                System.out.println("True, it's an anagram.");
 		        } else {
 	                    System.out.println("False, it isn't an anagram");
 	        }
 	        in.close();
 		    }
 		
 		 private static boolean Anagram_indeed(char[] first_input_phrase, char[] second_input_phrase) {
	               if (first_input_phrase.length != second_input_phrase.length) {
 		                  return false;
 		        }
 		                      for (int i = 0; i < first_input_phrase.length; i++) {
 		                  boolean check_char = false;
 		
 		                      for (int j = i; j < second_input_phrase.length; j++) {
 		            if (first_input_phrase[i] == second_input_phrase[j]) {
 		                   char buffer = second_input_phrase[j];
 		
 		                     second_input_phrase[j] = second_input_phrase[i];
 		                     second_input_phrase[i] = buffer;
 		                     check_char = true;
 	                       break;
 		                 }
 		            }
 		            if (!check_char) {
 		                  return false;
 	            }
 	       }
 	        return true;
 		    }
 		}
